package com.jackson.javaspring.controller;

/*
 * Author: JacksonCoder
 * FileName: HelloController
 * Version: 1.0.0
 * Date: 2025/3/27
 */


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    private static final String RESOURCE_NAME = "HelloWorld";

    // 手动定义日志变量
    private static final Logger log = LoggerFactory.getLogger(HelloController.class);
    @RequestMapping(value = "/hello")
    public String hello() {
        try {
            log.info("hello");
            return RESOURCE_NAME;
        } catch (Exception e) {
            log.error(e.getMessage(), e); // 建议传入异常对象，便于堆栈跟踪
        }
        return null;
    }
}
